package com.zzptc.syl.traffic;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

public class MyAdapter extends BaseAdapter {
    private List<Lamp.DataBean> dataBeans;

    public MyAdapter(List<Lamp.DataBean> dataBeans) {
        this.dataBeans=dataBeans;
    }

    @Override
    public int getCount() {
        return dataBeans.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        view= LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.row,viewGroup,false);
        TextView road=view.findViewById(R.id.road);
        TextView redtext=view.findViewById(R.id.red);
        TextView yellowtext=view.findViewById(R.id.yellow);
        TextView greentext=view.findViewById(R.id.green);
        road.setText(String.valueOf(dataBeans.get(i).getRoad()));
        redtext.setText(String.valueOf(dataBeans.get(i).getRed()));
        yellowtext.setText(String.valueOf(dataBeans.get(i).getYellow()));
        greentext.setText(String.valueOf(dataBeans.get(i).getGreen()));
        return view;
    }
}
